import numpy as np
import sys
import matplotlib.pylab as plt
#import matplotlib.pyplot as plt


svn_id = '$Id: read_mol.py 129 2013-05-03 12:21:57Z 23isgaaf@gmail.com $'


print 'running version:         ',svn_id.split()[2]
print 'last changes made by:    ',svn_id.split()[5]



"""
x = plt.randn(10000)

fig = plt.figure()
ax = fig.add_subplot(221)
ax2 = fig.add_subplot(122)
ax3 = fig.add_subplot(223)
ax.hist(x)
ax.set_xticks([1,4])
ax.set_xticklabels(['g','h'])
ax.grid(True)
ax3.hist(-x)
#plot([i for i in range(len(a))],a)

ax2.plot(a)
plt.show()
"""

def check_line(input,atom):
	if input.startswith('ATOM') and line.split()[2] == atom:
		return True
	else:
		return False


#file_name = 'cubane.pdb'

file_name = sys.argv[1]

buffer = open(file_name,'r')

lines = buffer.readlines()

a = []

print type(a)

#print '\n',file_name,'\n'

for line in lines :
    if check_line(line,'C'):
        b = float(line.split()[4])
        print b,' ',type(b)
        a.append(b)
print np.sum(np.abs(a))/len(a)
print '\n',np.mean(np.abs(a))
print len(a)

if __name__ == "__main__":
    print "ran from the command line"
        
    
    
    
    
    
    
